home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / Caste wipe right.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.3 KB  |  46 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 1
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6.  
  7. pascal short CasteWipeRight(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* This takes a strip (starting with the rightmost strip, moving left) and
  10.    copies it into all the strips starting at the left and moving right until
  11.    it's in the right place. */
  12.    
  13. pascal short CasteWipeRight(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  14. {
  15.     short            srcx, barpos;
  16.     Rect            src, dest;
  17.     Boolean            everyOther;
  18.     short            gap;
  19.     
  20.     gap=theWindowWidth/50;
  21.     everyOther=FALSE;
  22.     src.top = boundsRect.top;
  23.     src.bottom = boundsRect.bottom;
  24.     
  25.     for(srcx = boundsRect.right-gap; srcx >= boundsRect.left; srcx -= gap)
  26.     {
  27.         for(barpos = boundsRect.right; barpos >= boundsRect.left+gap; barpos -= gap) {}
  28.         for(; barpos <= srcx; barpos += gap)
  29.         {
  30.             StartTiming();
  31.             src.left = srcx;
  32.             src.right = srcx + gap;
  33.             dest = src;
  34.             dest.left = barpos;
  35.             dest.right = barpos + gap;
  36.             CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  37.                     &src, &dest, 0, 0L);
  38.             if (everyOther)                        /* really, we need time */
  39.                 TimeCorrection(CorrectTime);       /* correction 0.5, but  */
  40.             everyOther=!everyOther;                /* this will do (gag)   */
  41.         }
  42.     }
  43.     
  44.     return 0;
  45. }
  46.